#include "mvect.h"

void*
vector_append_obj(struct vector *vec, uint32_t sz)
{
	void*	ptr;
	uint32_t	off;

	off = vec->vect_cur;
	if (off >= vec->vect_max) {
		uint8_t*	nb;
		uint32_t	nsz;
		nsz = vec->vect_max >> 3;
		if (nsz > 1024) {
			nsz = 1024;
		} else if (nsz < 32) {
			nsz = 32;
		}
		nsz += vec->vect_max;
		nb = realloc(vec->vect_base, nsz);
		if (nb == NULL) {
			return	(NULL);
		}
		vec->vect_base = nb;
		vec->vect_max = nsz;
	}
	ptr = vec->vect_base + off;
	vec->vect_cur += sz;

	return	(ptr);
}


